package ModelLayer;
import java.util.ArrayList;

/**
 * Write a description of class DVDContainer here.
 * 
 * @author (Danny Melsen) 
 * @version (07.11.12)
 */
public class DVDContainer
{
    // instance variables - replace the example below with your own
    private ArrayList<Dvds> DVD;
    

    /**
     * Constructor for objects of class DVDContainer
     */
    public DVDContainer()
    {
        DVD = new ArrayList<Dvds>();
    }
    
    /**
     * Find a dvd
     */

    public Dvds findDvd(int id)
    {
        for (Dvds dvds : DVD) {
            if (dvds.getId() == id) {
            }
            return dvds;
        }
        return null;
    }
    
    /**
     * add a dvd
     */
    public void addDvd(Dvds dvds)
    {
        if (DVD.contains(dvds)){
            System.out.println ("the dvd is allready on the list");
        }
            else {
                DVD.add(dvds);
            }
    } 
    
    /**
     * delete a dvd
     */
    public void deleteDvd(Dvds dvds)
    {
        DVD.remove(dvds);
    }
    
    /**
     * List of all Dvds in the DVDContainer
     */
    public void listOfAllDvds()
    {
        for ( Dvds dvds : DVD ) {
            dvds.printInformationDvds();
        }
        
    }
}
    
    
